{{define "admin/profile.html"}}
    {{template "admin/page_start.html"}}
    {{template "admin/navbar.html" .}}
    {{template "admin/sidebar.html" .}}
    <!-- Content Wrapper. Contains page content -->
    <div class="content-wrapper">
        <!-- Content Header (Page header) -->
        <section class="content-header">
            <h1>
                Profile
            </h1>
            <ol class="breadcrumb">
                <li><a href="/admin/index"><i class="fa fa-dashboard"></i> Home</a></li>
                <li class="active">Profile</li>
            </ol>
        </section>

        <!-- Main content -->
        <section class="content">
            <div class="col-md-6">
                <!-- Horizontal Form -->
                <div class="box box-info">
                    <div class="box-header with-border">
                        <h3 class="box-title">个人信息</h3>
                    </div>
                    <!-- /.box-header -->
                    <!-- form start -->
                    <form class="form-horizontal">
                        <div class="box-body">
                            <div class="form-group">
                                <label for="inputEmail3" class="col-sm-2 control-label">Email</label>
                                {{if gt (len .user.Email) 0}}
                                    <div class="col-sm-6">
                                        <input type="email" class="form-control" id="inputEmail3" value="{{.user.Email}}" readonly placeholder="Email">
                                    </div>
                                {{else}}
                                    <div class="col-sm-6">
                                        <input type="email" class="form-control" id="inputEmail3" placeholder="Email">
                                    </div>
                                    <div class="col-sm-4">
                                        <a href="#" class="btn btn-primary" onclick="bindEmail();">绑定</a>
                                    </div>
                                {{end}}
                            </div>
                            <div class="form-group">
                                <label for="inputGithub" class="col-sm-2 control-label">Github</label>
                                {{if gt (len .user.GithubLoginId) 0}}
                                    <div class="col-sm-6">
                                        <input type="text" class="form-control" id="inputGithub" value="{{.user.GithubLoginId}}" readonly>
                                    </div>

                                {{else}}
                                    <div class="col-sm-4">
                                        <a href="/auth/github" class="btn btn-primary">绑定</a>
                                    </div>
                                {{end}}
                            </div>
                            <div class="form-group">
                                <label for="joinTime" class="col-sm-2 control-label">注册时间</label>
                                <div class="col-sm-6">
                                    <input type="text" class="form-control" id="joinTime" value="{{dateFormat .user.CreatedAt "2006-01-02 15:04:05"}}" readOnly>
                                </div>
                            </div>
                        </div>
                        <!-- /.box-body -->
                        <div class="box-footer">
                            <button type="submit" class="btn btn-info pull-right">Save</button>
                        </div>
                        <!-- /.box-footer -->
                    </form>
                </div>
            </div>
        </section>
        <!-- /.content -->
    </div>
    <!-- /.content-wrapper -->
    {{template "admin/page_end.html"}}

    <script type="text/javascript">
        function bindEmail(){

        }
        function bindGithub() {

        }
        function unbindGithub() {
            $.post("/admin/profile/github/unbind",{},function(result){
                if(result.succeed){
                    window.location.reload(true)
                }
            },'json');
        }
    </script>

{{end}}